package com.atguigu.gulimall.product.entity;

import com.atguigu.common.valid.AddGroup;
import com.atguigu.common.valid.ListValue;
import com.atguigu.common.valid.UpdateGroup;
import com.atguigu.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;
/**
 * 品牌
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@TableId
	@Null(message = "新增不能指定品牌id！", groups = {AddGroup.class})
	@NotNull(message = "修改必须指定品牌id！", groups = {UpdateGroup.class})
	private Long brandId;    //品牌id

	@NotBlank(message = "品牌名不能为空！", groups = {UpdateGroup.class, AddGroup.class})
	private String name;    //品牌名

	@NotEmpty(groups = {AddGroup.class})
	@URL(message = "logo必须是一个合法的url地址", groups = {UpdateGroup.class, AddGroup.class})
	private String logo;    //品牌logo地址

	private String descript;    //介绍

	@NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
	@ListValue(vals = {0, 1}, groups = {AddGroup.class})
	private Integer showStatus;    //显示状态[0-不显示；1-显示]

	@NotEmpty(groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {UpdateGroup.class, AddGroup.class})
	private String firstLetter;    //检索首字母

	@NotNull(groups = {AddGroup.class})
	@Min(value = 0, message = "排序必须大于等于0")
	private Integer sort;    //排序
}
